.class public Lcom/brixd/niceapp/ui/ZMProgressBar;
.super Landroid/widget/RelativeLayout;
.source "ZMProgressBar.java"


# instance fields
.field private mBgDrawable:Landroid/graphics/drawable/Drawable;

.field private mMaxProgress:F

.field private mProgress:F

.field private mProgressDrawable:Landroid/graphics/drawable/Drawable;

.field private mProgressView:Landroid/widget/ImageView;

.field private mWidth:I


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .registers 3
    .param p1, "context"    # Landroid/content/Context;

    .prologue
    .line 22
    invoke-direct {p0, p1}, Landroid/widget/RelativeLayout;-><init>(Landroid/content/Context;)V

    .line 14
    const/4 v0, 0x0

    iput v0, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mProgress:F

    .line 15
    const/high16 v0, 0x42c80000

    iput v0, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mMaxProgress:F

    .line 23
    invoke-direct {p0}, Lcom/brixd/niceapp/ui/ZMProgressBar;->init()V

    .line 24
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .registers 4
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "attrs"    # Landroid/util/AttributeSet;

    .prologue
    .line 27
    invoke-direct {p0, p1, p2}, Landroid/widget/RelativeLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;)V

    .line 14
    const/4 v0, 0x0

    iput v0, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mProgress:F

    .line 15
    const/high16 v0, 0x42c80000

    iput v0, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mMaxProgress:F

    .line 28
    invoke-direct {p0}, Lcom/brixd/niceapp/ui/ZMProgressBar;->init()V

    .line 29
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .registers 5
    .param p1, "context"    # Landroid/content/Context;
    .param p2, "attrs"    # Landroid/util/AttributeSet;
    .param p3, "defStyle"    # I

    .prologue
    .line 32
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/RelativeLayout;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 14
    const/4 v0, 0x0

    iput v0, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mProgress:F

    .line 15
    const/high16 v0, 0x42c80000

    iput v0, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mMaxProgress:F

    .line 33
    invoke-direct {p0}, Lcom/brixd/niceapp/ui/ZMProgressBar;->init()V

    .line 34
    return-void
.end method

.method private init()V
    .registers 4

    .prologue
    .line 37
    new-instance v1, Landroid/widget/ImageView;

    invoke-virtual {p0}, Lcom/brixd/niceapp/ui/ZMProgressBar;->getContext()Landroid/content/Context;

    move-result-object v2

    invoke-direct {v1, v2}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

    iput-object v1, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mProgressView:Landroid/widget/ImageView;

    .line 38
    iget-object v1, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mProgressView:Landroid/widget/ImageView;

    sget-object v2, Landroid/widget/ImageView$ScaleType;->FIT_XY:Landroid/widget/ImageView$ScaleType;

    invoke-virtual {v1, v2}, Landroid/widget/ImageView;->setScaleType(Landroid/widget/ImageView$ScaleType;)V

    .line 39
    new-instance v0, Landroid/widget/RelativeLayout$LayoutParams;

    const/4 v1, -0x1

    const/4 v2, -0x2

    invoke-direct {v0, v1, v2}, Landroid/widget/RelativeLayout$LayoutParams;-><init>(II)V

    .line 40
    .local v0, "params":Landroid/widget/RelativeLayout$LayoutParams;
    iget-object v1, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mProgressView:Landroid/widget/ImageView;

    invoke-virtual {p0, v1, v0}, Lcom/brixd/niceapp/ui/ZMProgressBar;->addView(Landroid/view/View;Landroid/view/ViewGroup$LayoutParams;)V

    .line 41
    iget-object v1, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mProgressView:Landroid/widget/ImageView;

    const v2, 0x7f02003a

    invoke-virtual {v1, v2}, Landroid/widget/ImageView;->setImageResource(I)V

    .line 42
    return-void
.end method

.method private updateProgress()V
    .registers 4

    .prologue
    .line 70
    iget-object v1, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mProgressView:Landroid/widget/ImageView;

    invoke-virtual {v1}, Landroid/widget/ImageView;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v0

    check-cast v0, Landroid/widget/RelativeLayout$LayoutParams;

    .line 71
    .local v0, "params":Landroid/widget/RelativeLayout$LayoutParams;
    iget v1, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mProgress:F

    iget v2, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mMaxProgress:F

    div-float/2addr v1, v2

    iget v2, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mWidth:I

    int-to-float v2, v2

    mul-float/2addr v1, v2

    float-to-int v1, v1

    iput v1, v0, Landroid/widget/RelativeLayout$LayoutParams;->width:I

    .line 72
    iget-object v1, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mProgressView:Landroid/widget/ImageView;

    invoke-virtual {v1, v0}, Landroid/widget/ImageView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    .line 73
    return-void
.end method

.method private validate(F)F
    .registers 3
    .param p1, "progress"    # F

    .prologue
    .line 63
    const/4 v0, 0x0

    invoke-static {p1, v0}, Ljava/lang/Math;->max(FF)F

    move-result p1

    .line 64
    iget v0, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mMaxProgress:F

    invoke-static {p1, v0}, Ljava/lang/Math;->min(FF)F

    move-result p1

    .line 66
    return p1
.end method


# virtual methods
.method public getProgress()F
    .registers 2

    .prologue
    .line 59
    iget v0, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mProgress:F

    return v0
.end method

.method protected onLayout(ZIIII)V
    .registers 7
    .param p1, "changed"    # Z
    .param p2, "l"    # I
    .param p3, "t"    # I
    .param p4, "r"    # I
    .param p5, "b"    # I

    .prologue
    .line 46
    invoke-super/range {p0 .. p5}, Landroid/widget/RelativeLayout;->onLayout(ZIIII)V

    .line 47
    invoke-virtual {p0}, Lcom/brixd/niceapp/ui/ZMProgressBar;->getWidth()I

    move-result v0

    iput v0, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mWidth:I

    .line 48
    invoke-direct {p0}, Lcom/brixd/niceapp/ui/ZMProgressBar;->updateProgress()V

    .line 49
    return-void
.end method

.method public setProgress(F)V
    .registers 3
    .param p1, "progress"    # F

    .prologue
    .line 52
    invoke-direct {p0, p1}, Lcom/brixd/niceapp/ui/ZMProgressBar;->validate(F)F

    move-result v0

    iput v0, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mProgress:F

    .line 53
    iget v0, p0, Lcom/brixd/niceapp/ui/ZMProgressBar;->mWidth:I

    if-lez v0, :cond_d

    .line 54
    invoke-direct {p0}, Lcom/brixd/niceapp/ui/ZMProgressBar;->updateProgress()V

    .line 56
    :cond_d
    return-void
.end method
